Repository navigation
Draw QC graphs and score cards with d3 instead of Protovis - #55
Merged
Merged
Conversation
The QC graphs ran on Protovis plus jQuery, and the score cards called the d3 v3 API without d3 ever being loaded, so they never rendered. Both are now Stimulus controllers on a vendored d3 7.9.0 ES module: - qc-graph fetches a visualization's JSON and draws its dot, area, bar, bubble or category-bubble graph, with a nearest-point hover label - score-card draws one circle per year from the datatable's scores Remove protovis-d3.2.js, proto-graphs.js, scores.js and the legacy importmap pins that served app/assets/javascripts. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_016AR3uoZS1uCC8hXmojk3K7
# Conflicts: # app/controllers/visualizations_controller.rb # app/javascript/controllers/index.js
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Replaces the Protovis-era graph scripts with Stimulus controllers that draw with d3, and deletes the old scripts. (The branch dates from 2026-10-25; master has been merged into it and the two conflicts resolved.)
Removed (about 15,700 lines):
app/assets/javascripts/protovis-d3.2.js(the Protovis library)app/assets/javascripts/proto-graphs.jsapp/assets/javascripts/scores.jslink_directoryline in the asset manifest and the legacy script loads inapplication.jsAdded:
qc_graph_controller.js: draws a QC graph from a visualization's JSON (dot graphs and line graphs, with axes and the y-axis label)score_card_controller.js: draws a datatable's yearly scoresvendor/javascript/d3.js: d3 7.9.0 as one ES module, pinned in the importmap (no CDN)spec/requests/d3_graphs_spec.rbThe QC page and score card views now hand each controller its data through
data-*values instead of inline script.Merge with master
Two conflicts, both keeping both sides:
visualizations_controller.rb: the class comment now says it serves the d3 graphs' data and that the data follows the datatable's download rules (PR Apply datatable download rules to visualization data #36).controllers/index.js: registersqc-graphandscore-cardalongside thetreecontroller added since.Testing
spec/requests/d3_graphs_spec.rb: each QC graph points at its visualization's data, type and label; visualization rows are served as JSON; the score card gets its yearly scores, or an empty list; the importmap loads d3 and none of the old scripts.schema.rbbefore 7f502da, since master's current schema can't be loaded into a fresh database (see the structure.sql PR Dump the database schema as db/structure.sql #53).zeitwerk:checkpasses.Related
Removes the last scripts that needed jQuery-era Protovis; jQuery itself is still loaded for four
.js.erbtemplates (see the dead-code checklist,docs/dead-code-checklist.mdondocs/dead-code-checklist).Generated by Claude Code